#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_flask1.py
# author:Jackiex
# datetime:2023/5/22 11:09
# software: PyCharm

"""
this is function  description 
"""

from flask import Flask
from flask import request

app = Flask(__name__)


@app.route('/login', methods=['GET'])
def login_from():
    return '''
    <form action="/login" method="post">
              <p><input name="username"></p>
              <p><input name="password" type="password"></p>
              <p><button type="submit">Sign In</button></p>
    </form
    '''


@app.route('/login',methods=['POST'])
def login():
    # 需要从读取表单里面的内容
    if request.form['username']=='admin' and request.form['password']== '123456':
        return '<h3>Hello, admin!</h3>'

    return '<h3>Bad username or password.</h3>'


if __name__ == '__main__':
    app.run(port=5000)
